package com.igeek.clud_system.controller;

import com.igeek.clud_system.common.Const;
import com.igeek.clud_system.entity.LntegrityScoreValue;
import com.igeek.clud_system.entity.PersonScore;
import com.igeek.clud_system.entity.Student;
import com.igeek.clud_system.service.ScoreValueService;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class ScoreValueController {
    @Autowired
    private ScoreValueService scoreValueService;
    @GetMapping("scoreValue")
    public List<LntegrityScoreValue> getScoreValue(HttpSession session){
        System.out.println("scoreValue");
        Student student=(Student) session.getAttribute(Const.LOGIN_USER);
        List<LntegrityScoreValue> lntegrityScoreValues=scoreValueService.findLntegrityScore(student.getStudentId());
        for (LntegrityScoreValue lntegrityScoreValue : lntegrityScoreValues) {
            System.out.println(lntegrityScoreValue.getValue()+"/"+lntegrityScoreValue.getScore());
        }
        return scoreValueService.findLntegrityScore(student.getStudentId());
    }
}
